# Replication code for "OAD: Testing Hypotheses of Voting Transparency"

# set the appropriate working directory
# setwd("...")
data <- read.csv("OA_D_data.csv")

# Table OA.D1: Explaining Voting Transparency
# Model 1
mod1 <- glm(RCV_SOP ~ Average_ballot_under_control_of_party + Size_of_the_chamber + 
            Single_member_district_seats + Legislature_can_remove_executive + Bicameralism + 
            Directly_elected_members, data=data, family = binomial(link = "logit"))
summary(mod1)
nobs(mod1) # 85
AIC(mod1) # 109.732
BIC(mod1) # 126.8306
logLik(mod1) # -47.86602

# Model 2
mod2 <- glm(RCV_SOP ~ Average_ballot_under_control_of_party*Size_of_the_chamber + 
            Single_member_district_seats + Legislature_can_remove_executive + Bicameralism +
            Directly_elected_members, data=data, family = binomial(link = "logit"))
summary(mod2)
nobs(mod2) # 85
AIC(mod2) # 109.0411
BIC(mod2) # 128.5823
logLik(mod2) # -46.52055

# Model 3
mod3 <- glm(RCV_SOP ~ Average_ballot_under_control_of_party + Size_of_the_chamber + 
            Single_member_district_seats + Legislature_can_remove_executive + Bicameralism + 
            Directly_elected_members + Polity_IV_index, data=data, family = binomial(link = "logit"))
summary(mod3)
nobs(mod3) # 85
AIC(mod3) # 108.2473
BIC(mod3) # 127.7885
logLik(mod3) # -46.12363

# Model 4
mod4 <- glm(RCV_SOP ~ Average_ballot_under_control_of_party*Size_of_the_chamber + 
            Single_member_district_seats + Legislature_can_remove_executive + Bicameralism +
            Directly_elected_members + Polity_IV_index, data=data, family = binomial(link = "logit"))
summary(mod4)
nobs(mod4) # 85
AIC(mod4) # 107.8464
BIC(mod4) # 129.8302
logLik(mod4) # -44.92318
